package com.pjhouse.core.user.persistence.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.pjhouse.core.common.persistence.IBatisBaseRepository;
import com.pjhouse.core.user.domain.UserDTO;
import com.pjhouse.core.user.persistence.UserRepository;

@SuppressWarnings("unchecked")
@Repository("userRepository")
public class UserRepositoryImpl extends IBatisBaseRepository implements
		UserRepository {

	@Override
	public long insert(UserDTO user) {
		return (Long)super.insert("PJ.USER.insert", user);
	}

	@Override
	public UserDTO queryById(long id) {
		return (UserDTO) super.queryForObject("PJ.USER.findById", id);
	}

	@Override
	public UserDTO queryByPhone(String phone) {
		return (UserDTO) super.queryForObject("PJ.USER.findByPhone", phone);
	}

	@Override
	public void update(UserDTO user) {
		super.update("PJ.USER.update", user);
	}

	@Override
	public List<UserDTO> queryAll() {
		return (List<UserDTO>)super.queryForList("PJ.USER.findAll");
	}

}
